﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using CrossQuery.ConditionQuery;
using SysInfo;

namespace CrossQuery
{
    static class Program
    {

        static void Main()
        {
            MultiSelectCondition multi = new MultiSelectCondition(Constant.DB_DATABASE, "yuqing", "xjjb");
            List<int> sv = new List<int>();
            sv.Add(0); sv.Add(2);
            multi.SelectedValues = sv;
            foreach (var value in multi.CandidateValues)
                Console.WriteLine(value.ToFullString());
            Console.WriteLine(multi.ToSQLString());

            BooleanCondition bc = new BooleanCondition(Constant.DB_DATABASE, "yuqing", "zdsj");
            List<int> sv1 = new List<int>();
            sv1.Add(0);
            bc.SelectedValues = sv1;
            foreach (var value in bc.CandidateValues)
                Console.WriteLine(value.ToFullString());
            Console.WriteLine(bc.ToSQLString());
            Console.WriteLine(((Condition)bc).ToSQLString());

            DateCondition dc = new DateCondition(Constant.DB_DATABASE, "yuqing", "bdsj");
            dc.StartDate = "2012-03-11";
            dc.EndDate = "2012-04-11";
            Console.WriteLine(dc.ToSQLString());

            string[] output_fields = {"almc", "sjnd"};
            ConditionalQuery cq = new ConditionalQuery(Constant.DB_DATABASE, "yuqing", output_fields);
            cq.AddCondition(multi);
            cq.AddCondition(bc);
            cq.RemoveCondition(bc);
            cq.AddCondition(dc);
            Console.WriteLine(cq.ToSQLCommand());
        }
 
    }
}
